home *** CD-ROM | disk | FTP | other *** search
/ FishMarket 1.0 / FishMarket v1.0.iso / fishies / 426-450 / disk_436 / aztecarp / source.lzh / crt0.asm < prev    next >
Assembly Source File  |  1990-12-05  |  2KB  |  75 lines

  1. ; Initial startup routine for Aztec 'C' and ARP
  2. ; NB: This should allow access to all Aztec Features, math, etc.
  3. ;     Could be made smaller if only for CLI, only for Workbench,
  4. ;     Could be made smaller if only this or that.
  5. ;
  6. ; Created 11/08/87 by -+=SDB+=- from crt0.a68 file provided by Manx
  7. ; Copyright (c) 1987 by Scott Ballantyne, may be freely
  8. ; used by Arp Supporters/users
  9. ;
  10. ; 10-Mar-90:    Some minor rework for Aztec 5.0 release.
  11. ;        This should rather use rstart.asm code.
  12. ;
  13.  
  14.     include "exec/types.i"
  15.     include "exec/alerts.i"
  16.     include "libraries/arpbase.i"
  17.     include    "exec/execbase.i"
  18.  
  19. call    macro
  20.     xref    _LVO\1
  21.     jsr    _LVO\1(a6)
  22.     endm
  23.  
  24.     mc68881
  25.     entry    .begin
  26.     public    .begin
  27. .begin
  28.     bsr    _geta4            ;get A4
  29.     lea    __H1_end,a1
  30.     lea    __H2_org,a2
  31.     cmp.l    a1,a2            ;check if BSS and DATA together
  32.     bne    start            ;no, don't have to clear
  33.     move.w    #((__H2_end-__H2_org)/4)-1,d1
  34.     bmi    start            ;skip if no bss
  35.     moveq    #0,d2
  36.  
  37. loop    move.l    d2,(a1)+                ;clear out memory
  38.     dbra    d1,loop
  39.  
  40. start    move.l    sp,__savsp        ;save stack pointer
  41.     move.l    (4).w,a6        ;get Exec's library base pointer
  42.     move.l    a6,_SysBase        ;put where we can get it
  43.     movem.l d0/a0,-(sp)             ;save CLI command parameters
  44.  
  45.     move.w    AttnFlags(a6),d0
  46.     btst    #AFB_68881,d0           ;check for 68881 flag in AttnFlags
  47.     beq    1$            ;skip if not
  48.     lea    2$,a5
  49.     call    Supervisor              ;do it in supervisor mode
  50.     bra    1$
  51.  
  52. 2$    clr.l    -(sp)
  53.     frestore (sp)+                  ;reset the ffp stuff
  54.     rte                ;and return
  55.  
  56. 1$    jsr    __main            ;call the startup stuff
  57.  
  58. 4$    addq.l    #8,sp            ;pop args
  59.     rts                ;and return
  60.  
  61.     public    _geta4
  62.  
  63. _geta4:    far    data
  64.     lea    __H1_org+32766,a4
  65.     rts
  66.  
  67.     public    __main,__H0_org
  68.  
  69.     dseg
  70.  
  71.     public    _SysBase,__savsp ; ,_DOSBase
  72.     public    __H1_org,__H1_end,__H2_org,__H2_end
  73.  
  74.     end
  75.